package builder.AccountFormBuilderPackage;

import java.awt.Component;
import java.awt.Font;

import handler.accountFormHandlers.RegisterCancelButtonActionListener;
import handler.accountFormHandlers.RegisterSubmitButtonActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;

import builder.FormBuilder;
import builder.FormBuilderDecorator;
import form.AccountForm.AccountForm;

public class RegisterDecorator extends FormBuilderDecorator{

	public RegisterDecorator(FormBuilder decoratee) {
		super(decoratee);
	}
	
	public void setFormSettings() {
		// TODO Auto-generated method stub
		super.setFormSettings();

	}

	public void buildComponents() {

		AccountForm accountForm = (AccountForm) decoratee.getForm();

		buildHeader(accountForm);
		
		super.buildComponents();
		
		buildButtons(accountForm);
	}
	
	public void buildHeader(AccountForm registerForm){
		JLabel lblHeader = new JLabel("REGISTRATION");
		lblHeader.setFont(new Font("Impact", Font.BOLD, 70));
		lblHeader.setAlignmentX(Component.CENTER_ALIGNMENT);
		registerForm.add(lblHeader);
	}
	
	public void buildButtons(AccountForm registerForm){
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.addActionListener(new RegisterCancelButtonActionListener());
		registerForm.add(btnCancel);

		JButton btnSubmit = new JButton("Submit");
		btnSubmit.addActionListener(new RegisterSubmitButtonActionListener(registerForm));
		registerForm.add(btnSubmit);
	}


}
